﻿package com.eitb.colecciones{
	import flash.geom.*;
	import flash.display.*;
	
	public class OrdenarDisplayObject {
		public function OrdenarDisplayObject():void {
		}
		public function porPosicion(a:DisplayObject, b:DisplayObject):int {

			
			var aPos:Point = new Point(Math.round(a.x), Math.round(a.y));
			var bPos:Point = new Point(Math.round(b.x), Math.round(b.y));
			var rslt:int;

			if (aPos.x > bPos.x) {
				rslt = 1;
			} else if (aPos.x < bPos.x) {
				rslt = -1;
			} else if (aPos.y > bPos.y) {
				rslt = 1;
			} else if (aPos.y < bPos.y) {
				rslt = -1;
			} else {
				rslt = 0;
			} 
			
			return rslt;
		}
	}
}